package com.zj.esproxy.model;

import com.zj.baseproxy.model.Page;

import java.util.Collections;
import java.util.List;

/**
 * @author arthur_zhou
 * @date 2024/4/11 10:46
 */
public class EsPage<T> extends Page<T> {

    private List<Agg> buckets;

    public EsPage(Long total, List<T> items, List<Agg> buckets) {
        super(total, items);
        this.buckets = buckets;
    }

    public static <T> EsPage<T> setPageData(List<T> items, Long total, List<Agg> buckets) {
        return new EsPage<>(total, items, buckets);
    }

    public static <T> EsPage<T> setPageData(List<T> items, Long total) {
        return setPageData(items, total, null);
    }

    public static <T> EsPage<T> setPageData(Long total) {
        return setPageData(Collections.emptyList(), total);
    }

    public static <T> EsPage<T> setPageData(List<T> items) {
        return setPageData(items, 0L);
    }

    public static <T> EsPage<T> setPageData() {
        return setPageData(Collections.emptyList(), 0L);
    }

    public List<Agg> getBuckets() {
        return buckets;
    }
}
